package v1beta1

import (
	"k8s.io/apimachinery/pkg/api/resource"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
	DefaultQuotaCrName              = "quota"
	ResourceHost       ResourceName = "ecshost"
	ResourceEvs        ResourceName = "evs"
	ResourceDisk       ResourceName = "disk"
	ResourceVpc        ResourceName = "vpc"
	ResourceFileVolume ResourceName = "filevolume"
	ResourceImage      ResourceName = "image"

	QuotaPropertyHostCpu      QuotaProperty = "cpu_cores"
	QuotaPropertyHostRam      QuotaProperty = "ram"
	QuotaPropertyHostGpu      QuotaProperty = "gpu"
	QuotaPropertyHostInstance QuotaProperty = "instance"

	QuotaPropertyEvsCount    QuotaProperty = "evs_count"
	QuotaPropertyEvsCapacity QuotaProperty = "evs_capacity"
	QuotaPropertyEvsSnapshot QuotaProperty = "evs_snapshot"

	QuotaPropertyDiskCount    QuotaProperty = "disk_count"
	QuotaPropertyDiskCapacity QuotaProperty = "disk_capacity"
	QuotaPropertyDiskSnapshot QuotaProperty = "disk_snapshot"

	QuotaPropertyFileVolumeCount    QuotaProperty = "sfs_count"
	QuotaPropertyFileVolumeCapacity QuotaProperty = "sfs_capacity"
	QuotaPropertyFileVolumeSnapshot QuotaProperty = "sfs_snapshot"
	QuotaPropertyImageCount         QuotaProperty = "image_count"

	QuotaPropertyVpcCount       QuotaProperty = "vpc_count"
	QuotaPropertyVpcSubnetCount QuotaProperty = "vpc_subnet"
)

// McResourceQuotaSpec defines the desired state of nat
type McResourceQuotaSpec struct {
	Hard ResourceList `json:"hard,omitempty"`
}
type ResourceName string
type QuotaProperty string
type ResourceList map[string]map[string]*resource.Quantity

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=mcquota
// +kubebuilder:subresource:status

// McResourceQuota is the Schema for the mcquota API
type McResourceQuota struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   McResourceQuotaSpec   `json:"spec,omitempty"`
	Status McResourceQuotaStatus `json:"status,omitempty"`
}
type McResourceQuotaStatus struct {
	Used ResourceList `json:"resourceList"`
	//+optional
	ResourcesUsed map[string]ResourceList `json:"resourcesUsed"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// McResourceQuotaList contains a list of mcquota item
type McResourceQuotaList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []McResourceQuota `json:"items"`
}
